-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not retrieve Blob metadata on batch delete #23650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
getBlob(storage, new GcsLocation(location)) | ||
.ifPresent(blob -> batch.delete(blob.getBlobId())); | ||
GcsLocation gcsLocation = new GcsLocation(location); | ||
batch.delete(BlobId.of(gcsLocation.bucket(), gcsLocation.path())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this does not throw if the blob does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't throw:
Calling StorageBatchResult.get() on the return value yields true upon successful deletion, false if the blob was not found, or throws a StorageException if the operation failed.
@@ -169,8 +169,8 @@ public void deleteFiles(Collection<Location> locations) | |||
for (List<Location> locationBatch : partition(locations, batchSize)) { | |||
StorageBatch batch = storage.batch(); | |||
for (Location location : locationBatch) { | |||
getBlob(storage, new GcsLocation(location)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious, did you spot it by chance or was there a delete files in bulk slow?
This should make batch delete way faster as it won't resolve blob metadata.
Description
Additional context and related issues
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: